const def={
  
}
export function ListenScroll(){
  let oldScroll=null;
  let sets=null;
  return function (e,obj={}){
    // let co=Object.assign(def,obj);
    const top=e.detail.scrollTop;
    if(oldScroll==null){
      oldScroll=top
    }
    clearTimeout(sets)
    sets=setTimeout(_=>{
      oldScroll=null;
    },300)
    
    return {
      up(fn){
        if(obj.max&&top>obj.max) return
        if(oldScroll-top<0){
          fn()
        }
      },
      down(fn){
        if(obj.max&&top>obj.max) return
        if(oldScroll-top>0){
          fn()
        }
       
      }
    }
  }
}